/*
	File:		RangedWeapon.cpp
	Author:		Ben Feldmann
	Purpose:	Base Class for ranged weapons
*/

#include "RangedWeapon.h"
#include "Player.h"
#include "GamePlayState.h"

bool RangedWeapon::CheckCollision(IEntity* base)
{
	return false;
}

void RangedWeapon::Attack()
{

}

void RangedWeapon::SpecialAttack()
{

}

void RangedWeapon::Render()
{
	SetX(player->GetX() + player->GetWidth());
	SetY(player->GetY());

	SetDirection(player->GetDirection());

	if(player->GetCurWeapon() == 2)
	{
		if(GetTextureID() != -1)
		{
			CSGD_TextureManager::GetInstance()->Draw(GetTextureID(),
				int(GetX() - GamePlayState::GetInstance()->GetCamX() - player->GetWidth()/2),
				int(GetY() - GamePlayState::GetInstance()->GetCamY() + player->GetHeight()/2));
		}
	}
}


void RangedWeapon::Update(float elapsed)
{
	shotTimer += elapsed;
	cooldownTimer += elapsed;

	if(shotTimer >= ROF)
	{
		attackReady = true;
		//shotTimer = 0;
	}

	if(cooldownTimer >= cooldownSeconds)
	{
		specialReady = true;
		//player->SetEnergy(player->GetEnergy() - energyCost);
		//cooldownTimer = 0;
	}

	if(emitter != nullptr)
		emitter->Update(elapsed);
}